from django import forms
from .models import  UserInfo
from django.contrib.auth.models import User


class LoginForm(forms.Form):
	username = forms.CharField()
	password = forms.CharField(widget=forms.PasswordInput)

class RegistrationForm(forms.ModelForm):
	password = forms.CharField(label='Password', widget=forms.PasswordInput)
	password2 = forms.CharField(label='Password confirm', widget=forms.PasswordInput)
	class meta:
		model = User
		fields=['username','email'] 

def clean_password2(self):
	cd = self.clean_data
	if cd['password'] != cd['password2']:
		raise forms.ValidationError("password do not match ")
	return cd['password2']